from timeit import timeit

def test_for():
    n = 10
    res = 0
    for i in range(1, n + 1):
        res += i


def test_while():
    n = 10
    res = 0
    i = 1
    while i <= n:
        res += i
        i += 1


def test_lambda():
    a = [x for x in range(10000000)]
    b = [i for i in a]


def test_list():
    a = list(x for x in range(10000000))
    b = list(a)


def main():
    t1 = timeit(stmt=test_lambda, number=5)
    t2 = timeit(stmt=test_list, number=5)
    print(f"for: {t1}, while: {t2}")


if __name__ == "__main__":
    main()
